package com.salt.admin.api.feign.client;

import com.salt.admin.api.feign.hystrix.DictClientHystrix;
import com.salt.admin.api.feign.interceptor.FeignTokenInterceptor;
import com.salt.admin.api.model.DictValue;
import com.salt.common.constant.Common;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description
 * @Author salt
 * @Date 2020/7/30 17:17
 * @Version 1.0
 */
@FeignClient(name = Common.Service.SALT_ADMIN_SERVICE_NAME,
        path = Common.Service.SALT_ADMIN_DICT_URL_PREFIX,
        fallbackFactory = DictClientHystrix.class,
        configuration = FeignTokenInterceptor.class)
public interface DictClient {

    @PostMapping("value")
    public String getDictValue(@RequestParam("label") String label,
                               @RequestParam("type") String type,
                               @RequestParam("defaultLabel") String defaultLabel);

    @PostMapping("label")
    public String getDictLabel(@RequestParam("value") String value,
                               @RequestParam("type") String type,
                               @RequestParam("defaultLabel") String defaultLabel);

    @PostMapping("type")
    public List<DictValue> getDictList(@RequestParam("type") String type);

}
